//
//  ConvertQuanViewController.m
//  1243
//
//  Created by 杨森 on 16/4/8.
//  Copyright © 2016年 1243. All rights reserved.
//

#import "ConvertQuanViewController.h"
#import "ConcertQuanTableViewCell.h"

@interface ConvertQuanViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UITableView *convertTableView;

@end

@implementation ConvertQuanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"兑换";
    self.view.backgroundColor = [UIColor whiteColor];
    [self addUI];
}

- (void)addUI
{
    CGFloat h = 40;
    UIView *lastView = [[UIView alloc] initWithFrame:CGRectMake(0,HEIGHT-h, WEITH, h)];
    
    lastView.backgroundColor = [UIColor whiteColor];
    
    UIButton *outDateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [lastView addSubview:outDateBtn];
    [outDateBtn setBackgroundImage:[UIImage imageNamed:@"查看兑换记录"] forState:UIControlStateNormal];
    
    CGFloat btnW = 100;
    outDateBtn.frame = CGRectMake(WEITH/2-btnW/2,10,btnW,15);
    
    self.convertTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0, WEITH, HEIGHT)];
    self.convertTableView.delegate = self;
    self.convertTableView.dataSource = self;
   
    [self.view addSubview:self.convertTableView];
    [self.view addSubview:lastView];
    self.convertTableView.rowHeight = 200;
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"使用说明" style:UIBarButtonItemStylePlain target:self action:@selector(useItemClick)];
    self.navigationItem.rightBarButtonItem = item;
    
}

- (void)useItemClick
{
    NSLog(@"使用说明");
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *identifier= @"convertCell";
    
    ConcertQuanTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
    
    if (cell==nil) {
       
        cell = [[[NSBundle mainBundle] loadNibNamed:@"ConcertQuanTableViewCell" owner:nil options:nil] lastObject];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    return cell;
}

@end
